package models

type ClosurePoint struct {
	Id        int     `xorm:"not null pk autoincr comment('自增主键') INT(11)"`
	ClosureId int     `xorm:"not null comment('围栏id外键关联dts_closure中的id') index INT(11)"`
	Latitude  float32 `json:"lat" xorm:"not null comment('纬度x/度，单位精确到小数点后6位') FLOAT(15,13)"`
	Longitude float32 `json:"lng" xorm:"not null comment('经度y/度，单位精确到小数点后6位') FLOAT(16,13)"`
	Order     int     `json:"order" xorm:"not null comment('当前点在围栏中的顺序序数') SMALLINT(5)"`
}

func (c *ClosurePoint) GetClosurePointListByClosureId(id int) (list []*ClosurePoint, err error) {
	err = engine.Table("dts_closure_point").
		Where("closure_id = ?", id).OrderBy("id").
		Find(&list)
	return list, err
}
